import {
	myRequest
} from '../http.js'
import http from '../api.js';
import * as stores from '@/stroes';
// 通过用户id获取消纳场列表
export function getTerminalByUserId(userId) {
	return myRequest({
		url: 'app/user/getTerminalByUserId/' + userId,
	})
}
// 识别车牌
export function uploadCartImg(config) {
	const userStore = stores.useUserStore()

	return uni.uploadFile({
		url: http.baseURL + 'appVehicle/identifyPlateNumber',
		filePath: config.file[0],
		method: 'POST',
		name: 'file',
		header: {
			'Content-Type': "multipart/form-data",
			'Authorization': 'Bearer ' + userStore?.accountInfo['access_token']
		}
	});


}
// 分页 ---获取收料列表
export function getList(config) {
	return myRequest({
		url: 'internal/page',
		method: 'GET',
		data: config,
	})
}
// 获取物料类型 
export function muckTypeAll(config) {
	return myRequest({
		url: 'muckType/listAll',
		method: 'GET',
		data: config,
	})
}
// 上传物料照片
export function uploadMaterialImg(config) {
	const userStore = stores.useUserStore()

	return uni.uploadFile({
		url: http.baseURL + 'sys-file/upload',
		filePath: config.file,
		method: 'POST',
		name: 'file',
		header: {
			'Content-Type': "multipart/form-data",
			'Authorization': 'Bearer ' + userStore?.accountInfo['access_token']

		}
	});
}
// 获取联单详情
export function getReceivingDetail(id) {
	return myRequest({
		url: `internal/${id}`,
		method: 'GET'
	})
}
// 收料签收确认
export function saveSign(data) {
	return myRequest({
		url: 'internal/sign',
		method: 'POST',
		data
	})
}
// 获取用户地址信息
export function getInfoUser(config) {
	return myRequest({
		url: `app/user/getAppByUserId/${config.userId}`,
		method: 'GET',
	})
}

// 信息补全
export function saveInformation(data) {
	return myRequest({
		url: 'internal/completion',
		method: 'POST',
		data
	})
}